package com.hdoit.ares.logical.acti.dao.impl;

import java.util.List;

import org.springframework.stereotype.Component;

import com.hdoit.ares.logical.acti.dao.IActivityDao;
import com.hdoit.ares.logical.acti.model.Activity;
import com.hdoit.ares.logical.viewmodel.acti.ActivitySearch;
import com.tennetcn.common.dao.base.IFinderExpression;
import com.tennetcn.common.dao.base.impl.SuperDao;
import com.tennetcn.common.enums.OrderEnum;
import com.tennetcn.common.message.PagerModel;
import com.tennetcn.common.utils.FinderExpressionFactory;
/**
 * @author      caochengmeng
 * @email       
 * @createtime  2018年03月10日 16:17:40
 * @comment
 */
@Component
public class ActivityDaoImpl extends SuperDao<Activity> implements IActivityDao{
	
	@Override
	public List<Activity> queryListHotActivitys() {
		IFinderExpression finderExpression=FinderExpressionFactory.createExpression();
		finderExpression.select("*")
						.from(Activity.class)
						.andEq("confirmState","confirmed")
						.andEq("actiType", "hotActivity")
						.andEq("actiState", "up")
						.addOrder("createDate", OrderEnum.asc);
		return queryList(finderExpression);
	}
	
	@Override
	public List<Activity> queryListHotActivitys(PagerModel pagerModel,ActivitySearch search) {
		IFinderExpression finderExpression=FinderExpressionFactory.createExpression();
		finderExpression.select("*")
						.from(Activity.class)
						.andEq("confirmState","confirmed")
						.andEq("actiType", "hotActivity")
						.andEq("actiState", "up")
						.addOrder("createDate", OrderEnum.asc);
		return queryList(finderExpression,search,pagerModel);
	}
}